package cn.trasen.his.poc.std.api.model.major;

import pro.shushi.pamirs.boot.base.ux.annotation.field.UxWidget;
import pro.shushi.pamirs.boot.base.ux.annotation.view.UxTableSearch;
import pro.shushi.pamirs.meta.annotation.Field;
import pro.shushi.pamirs.meta.annotation.Model;
import pro.shushi.pamirs.meta.base.IdModel;

import java.util.List;

/**
 * @author shushi
 */
@Model.model(HospInfo.MODEL_MODEL)
@Model(displayName = "院区", labelFields = {"hospName"})
@Model.Advanced(unique = {"hospCode"})
public class HospInfo extends IdModel {

    public static final String MODEL_MODEL = "ts.his.HospInfo";

    @UxTableSearch.FieldWidget(@UxWidget())
    @Field.many2one
    @Field.Relation(relationFields = {"orgCode"}, referenceFields = {"code"})
    @Field(displayName = "所属机构", required = true)
    private OrgInfo orgInfo;

    @Field.String
    @Field(displayName = "所属机构编码", invisible = true)
    private String orgCode;

    @UxTableSearch.FieldWidget(@UxWidget())
    @Field.String
    @Field(displayName = "院区代码", required = true)
    private String hospCode;

    @UxTableSearch.FieldWidget(@UxWidget())
    @Field.String
    @Field(displayName = "院区名称", required = true)
    private String hospName;

    @Field.String
    @Field(displayName = "院区地址", required = true)
    private String address;

    @Field(displayName = "联系电话")
    private String contactPhone;

    @Field.one2many
    @Field.Relation(relationFields = {"hospCode"}, referenceFields = {"hospCode"})
    @Field(displayName = "科室")
    private List<DeptInfo> deptInfo;

    @Field.one2many
    @Field.Relation(relationFields = {"hospCode"}, referenceFields = {"hospCode"})
    @Field(displayName = "病区")
    private List<WardInfo> wardInfo;

}
